Python modules

This modules are provided with the library to ease the interoperability between I/O of the Fortran library with python scripting

Utils module

YamlIO module

Inputvars module

Handle the input variable specifications.

This module is the python complement to the specification of the input variables of a file as provided by the f_input_file module. It uses the same syntax as defined there and make possible the interplay between a python-based serialization of the input dictionary and the construction of

class futile.Inputvars.InputVariable(name, spec)[source]

Bases: object

Define a input variable of a library. Such object can be initialized and inspected from the dictionary used by futile and then initialized according to the provided specification.

is_valid()[source]
set(val)[source]

Set the value of the input variable

set_dependent_variable(var)[source]

Set the dependent variable from which impose the profile

set_master_variable(var)[source]

Set the variable which is activated when the present has suitable values or profiles

ArgParse module

Handle and automatize the parsing of input arguments

This module uses the same convention of the yaml_parse fortran module to define the command line arguments. Such module can be used to define command line arguments of python scripts that follows the same conventions or to generate python functions that have the same signature than the provided command arguments.

futile.YamlArgparse.get_python_function(target_kwargs_function, func_name, func_spec)[source]

Convert a argparse spec into a python function

This function provides a python function with a signature indicated by the fun_spec dictionary With the conventions of the yaml_argparse modules. The futile.Utils.function_signature_regenerator() function is used for the conversion

Parameters
  • target_kwargs_function (func) – the keyword arguments function we want to give the signature to.

  • func_name (str) – Name of the function, usually the key of the dictionary whose func_spec is the value

  • func_spec (dict) – dictionary of the function specifications to be provided to the futile.Utils.function_signature_regenerator() function.

Returns

the genreated function with signature given by the arguments of func_spec

defaulting to their default value.

Return type

func

Todo

Create the docstring of the generated function by also including the docstring of the arguments

Figures module

class futile.Figures.AxisSet(fig, rect, *, facecolor=None, frameon=True, sharex=None, sharey=None, label='', xscale=None, yscale=None, box_aspect=None, **kwargs)[source]

Bases: matplotlib.axes._axes.Axes

cla()[source]

Clear the Axes.

create_twin()[source]
set(*, adjustable=<UNSET>, agg_filter=<UNSET>, alpha=<UNSET>, anchor=<UNSET>, animated=<UNSET>, aspect=<UNSET>, autoscale_on=<UNSET>, autoscalex_on=<UNSET>, autoscaley_on=<UNSET>, axes_locator=<UNSET>, axisbelow=<UNSET>, box_aspect=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, facecolor=<UNSET>, frame_on=<UNSET>, gid=<UNSET>, in_layout=<UNSET>, label=<UNSET>, navigate=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, position=<UNSET>, prop_cycle=<UNSET>, rasterization_zorder=<UNSET>, rasterized=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, title=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, xbound=<UNSET>, xlabel=<UNSET>, xlim=<UNSET>, xmargin=<UNSET>, xscale=<UNSET>, xticklabels=<UNSET>, xticks=<UNSET>, ybound=<UNSET>, ylabel=<UNSET>, ylim=<UNSET>, ymargin=<UNSET>, yscale=<UNSET>, yticklabels=<UNSET>, yticks=<UNSET>, zorder=<UNSET>)

Set multiple properties at once.

Supported properties are

Properties:

adjustable: {‘box’, ‘datalim’} agg_filter: a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array alpha: scalar or None anchor: (float, float) or {‘C’, ‘SW’, ‘S’, ‘SE’, ‘E’, ‘NE’, …} animated: bool aspect: {‘auto’, ‘equal’} or float autoscale_on: bool autoscalex_on: bool autoscaley_on: bool axes_locator: Callable[[Axes, Renderer], Bbox] axisbelow: bool or ‘line’ box_aspect: float or None clip_box: .Bbox clip_on: bool clip_path: Patch or (Path, Transform) or None facecolor or fc: color figure: .Figure frame_on: bool gid: str in_layout: bool label: object navigate: bool navigate_mode: unknown path_effects: .AbstractPathEffect picker: None or bool or float or callable position: [left, bottom, width, height] or ~matplotlib.transforms.Bbox prop_cycle: unknown rasterization_zorder: float or None rasterized: bool sketch_params: (scale: float, length: float, randomness: float) snap: bool or None title: str transform: .Transform url: str visible: bool xbound: unknown xlabel: str xlim: (bottom: float, top: float) xmargin: float greater than -0.5 xscale: {“linear”, “log”, “symlog”, “logit”, …} or .ScaleBase xticklabels: unknown xticks: unknown ybound: unknown ylabel: str ylim: (bottom: float, top: float) ymargin: float greater than -0.5 yscale: {“linear”, “log”, “symlog”, “logit”, …} or .ScaleBase yticklabels: unknown yticks: unknown zorder: float

classmethod twinify(ax)[source]

Include the axis provided as a radix of the set

class futile.Figures.FigureSet(**kwargs)[source]

Bases: object

Container for multiple figures.

Define a container for a plot with the possiblity to switch between simple and gnuplot plotting

Arguments: title: The title of the master figure **kwargs: arguments for the axis instance

add(**kwargs)[source]
exists(figname)[source]

True if the Figure exists in the Set

invoke(idx)[source]
show(figname=None)[source]
class futile.Figures.VertSlider(ax, label, valmin, valmax, valinit=0.5, valfmt='%1.2f', closedmin=True, closedmax=True, slidermin=None, slidermax=None, dragging=True, **kwargs)[source]

Bases: matplotlib.widgets.AxesWidget

A slider representing a floating point range.

For the slider to remain responsive you must maintain a reference to it.

\*ax*

the slider matplotlib.axes.Axes instance

\*val*

the current slider value

\*hline*

a matplotlib.lines.Line2D instance representing the initial value of the slider

\*poly*

A matplotlib.patches.Polygon instance which is the slider knob

\*valfmt*

the format string for formatting the slider text

\*label*

a matplotlib.text.Text instance for the slider label

\*closedmin*

whether the slider is closed on the minimum

\*closedmax*

whether the slider is closed on the maximum

\*slidermin*

another slider - if not None, this slider must be greater than slidermin

\*slidermax*

another slider - if not None, this slider must be less than slidermax

\*dragging*

allow for mouse dragging on slider

Call on_changed() to connect to the slider event

disconnect(cid)[source]

remove the observer with connection id cid

on_changed(func)[source]

When the slider value is changed, call func with the new slider position

A connection id is returned which can be used to disconnect

reset()[source]

reset the slider to the initial value if needed

set_val(val)[source]
futile.Figures.axis_from_data(fig, ax, data)[source]

Transform a data tuple into axis coordinates

futile.Figures.data_from_data(fig, dst, src, data)[source]

Transform a data tuple of anothe axis in the figure into data of another axis

futile.Figures.show_image(imgfile, title=None)[source]

Show image file using matplotlib imgread. Useful to bypass the Jupyter bug for converting a notebook into a pdf file

Time module

class futile.Time.TimeData(*filenames, **kwargs)[source]

Bases: object

barwidth = 0.9
collect_categories(dict_list, vals)[source]

Collect all the categories which belong to all the dictionaries

counters()[source]

Inspect the available counters

draw_barfigure(fig, axis, data, title)[source]
draw_lineplot(ax, data, label)[source]
find_items(category, dict_list)[source]

For a given category find the items which have them

find_unbalanced(data)[source]

Determine lookup array of unbalanced categories

gnuplot_figure(lookup=None, epsfile=None, aggregate=None, select_category=None)[source]
ignored_counters = ['CPU parallelism', 'Routines timing and number of calls', 'SUMMARY', 'Report timestamp', 'Hostnames']
inspect_category(cat)[source]
inspect_counter(counter, unit=None)[source]
load_unbalancing(ax, dict, hosts)[source]

Extract the data for plotting the hostname balancings between different categories in bar chart

replot(label)[source]
routines_plot(index, event=None)[source]

Draw the plot of the routines level for the run identified by index

show()[source]
unbalanced(val)[source]

Criterion for unbalancing

workload_plot(index, event=None)[source]

Draw the plot of the workload of different classes for the run identified by index

class futile.Time.polar_axis(fig, ax, data)[source]

Bases: object

draw_polarplot()[source]
dump_timing_level(level, starting_point=None, ilev=0, theta=0, data=None)[source]

Inspect the first level of the given dictionary and dump the profile subroutines at this level

step = 5